/**
* This file is part of mobileworks.
*
* mobileworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* You should have received a copy of the GNU General Public License
* along with dev.clipall.  If not, see <http://www.gnu.org/licenses/>.
*
* https://code.google.com/p/mobileworks/
*/

/*
 * HashSet.java
 * Created on July 25, 2007, 9:43 AM
 */

package utils;

import java.util.Vector;

/**
 *
 * @author erol
 */
public class HashSet {
    
    private Vector vector;
    
    public HashSet() {
        vector = new Vector();
    }
    
    public void add(Object element){
        if(vector.contains(element) == false){
            vector.addElement(element);
        }
    }
    
    public Object get(int index){
        return vector.elementAt(index);
    }
    
    public void remove(Object element){
        vector.removeElement(element);
    }
    
    public void remove(int index){
        try{
            vector.removeElementAt(index);
        }catch(ArrayIndexOutOfBoundsException e){}        
    }
    
    public void removeAll(){
        if(vector.size() > 0){
            vector.removeAllElements();
        }
    }
    
    public int indexOf(Object element){
        return vector.indexOf(element);
    }
    
    public int indexOf(Object element, int start){
        return vector.indexOf(element, start);
    }
    
    public int size(){
        return vector.size();
    }
}
